package com.gdth.bank.adapter;

import com.gdth.bank.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;

public class LifeAdapter extends BaseAdapter{
	private LayoutInflater mInflater;
	
	private String[] mData;
	
	public LifeAdapter(Context context, String[] mData) {
	    this.mInflater = LayoutInflater.from(context);
	    
	    this.mData = mData;
    }
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return this.mData.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return this.mData[position];
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
        //观察convertView随ListView滚动情况            
        if (convertView == null) {
        	convertView = mInflater.inflate(R.layout.item_life, null);
        	holder = new ViewHolder();
        	/*得到各个控件的对象*/                    
        	holder.title = (TextView) convertView.findViewById(R.id.item_txt_name);
        	holder.text = (TextView) convertView.findViewById(R.id.item_txt_val);
        	holder.bt = (TextView) convertView.findViewById(R.id.item_btn);
        	convertView.setTag(holder);//绑定ViewHolder对象                   
    	}else{
            holder = (ViewHolder)convertView.getTag();//取出ViewHolder对象                  
        }
        /*设置TextView显示的内容，即我们存放在动态数组中的数据*/   
        if (position == 1)
        	holder.title.setText(mData[0]);
        holder.text.setText("ssssssssssssssss" + position);                   
        
        
        return convertView;


	}
    	public final class ViewHolder{
    		public TextView title;
    		public TextView text;
    		public TextView   bt;
        }

}
